<?php
    /**
     * This is the generator for the User Button (Top Right of the bootstrap template).
     * 
     * If Logged in you can set the username, by default it says Guest:
     * $TemplateEngine->set_dropdown_username($_LOGGEDINUSER->get_username());
     * 
     * 
     * If has drop down menus these can be added:
     *	    $TemplateEngine->create_dropdown_html(false, 'URL', 'Link Title');
     * or partitions in the drop down menu can be added
     *	    $Templater->create_dropdownItem(true);
     * 
     * 
     * When the items for the drop down menus are created you should add them into the template system output buffer
     * EG:
     * 	    $var = $Templater->create_dropdownItem(true);
     *	    $TemplateEngine->create_dropdown_html($var);
     *		    ==OR==
     *	    $TemplateEngine->create_dropdown_html($Templater->create_dropdownItem(true));
     */

    if(isset($_LOGGEDINUSER) === false || (isset($_LOGGEDINUSER) === true && $_LOGGEDINUSER === false)) {
	$TemplateEngine->create_dropdown_html($Templater->create_dropdownItem(false, '/su/login', 'Login'));
	$TemplateEngine->create_dropdown_html($Templater->create_dropdownItem(false, '/add/user', 'Register'));
    } else {
	$TemplateEngine->set_dropdown_username($_LOGGEDINUSER->get_username());
	$TemplateEngine->create_dropdown_html($Templater->create_dropdownItem(true));
	$TemplateEngine->create_dropdown_html($Templater->create_dropdownItem(false, EclipseMDE::userLink($_LOGGEDINUSER->get_username()), 'Your Profile'));
	$TemplateEngine->create_dropdown_html($Templater->create_dropdownItem(false, '/su/settings', 'Settings'));
	if($_LOGGEDINUSER->get_priv_adm() === true) {
	    $TemplateEngine->create_dropdown_html($Templater->create_dropdownItem(true));
	    $TemplateEngine->create_dropdown_html($Templater->create_dropdownItem(false, '/admin/index.php', 'Admin Panel'));
	}
	$TemplateEngine->create_dropdown_html($Templater->create_dropdownItem(true));
	$TemplateEngine->create_dropdown_html($Templater->create_dropdownItem(false, '/su/logout', 'Logout'));
    }
?>
